import {
  Request
} from '../../util/request.js'



class HttpApi extends Request {
  code2session(code) {
    return this.getData({
      url: '/api/login',
      method: "GET",
      data: {
        authCode: code
      }
    })
  }

  login(username, password, type,wxUserInfo,openid) {
    return this.getData({
      url: '/api/loginUser',
      method: "GET",
      data: {
        username: username,
        password: password,
        type: type,
        wxUserInfo: wxUserInfo,
        openid: openid
      }
    })
  }

  course() {
    return this.getData({
      url: '/system/course/list',
      method: "GET",
      data: {
       
      }
    })
  }

  article() {
    return this.getData({
      url: '/system/knowledgeArticle/list',
      method: "GET",
      data: {

      }
    })
  }

  /* 主页--获取后台发送的验证码 */
  msgcode(phoneNum) {
    //绑定新手机或新手机
    // if (type == 1 && type == 3) {
    return this.getData({
      url: '/msgcode',
      method: "GET",
      data: {

        mobileno: phoneNum,
      }
    })
    // }
    // //修改手机号时手机号接收的验证码
    // else if (type == 2) {
    //     console.log(type)
    //     return this.getData({
    //         url: '/msgcode',
    //         method: "GET",
    //         data: {
    //             
    //         }
    //     })
    // }
  }

  register(openid, nickname, sex, city, country, province, headimgurl, unionid, mobileno, msgcode) {
    return this.getData({
      url: '/register',
      method: "POST",
      data: {
        openid: openid,
        nickname: nickname,
        sex: sex,
        city: city,
        country: country,
        province: province,
        headimgurl: headimgurl,
        unionid: unionid,
        mobileno: mobileno,
        msgcode: msgcode
      }
    })
  }

  editUser(communityId, roomNumber) {
    return this.getData({
      url: '/editUser',
      method: "POST",
      data: {
        communityId: communityId,
        roomNumber: roomNumber
      }
    })
  }

  editUser(communityId, roomNumber, createBy) {
    return this.getData({
      url: '/editUser',
      method: "POST",
      data: {
        communityId: communityId,
        roomNumber: roomNumber,
        createBy: createBy
      }
    })
  }

  centre() {
    return this.getData({
      url: '/centre',
      method: "GET",
      data: {

      }
    })
  }


  indexPic() {
    return this.getData({
      url: '/indexPic',
      method: "GET",
      data: {

      }
    })
  }

  countToday() {
    return this.getData({
      url: '/countToday',
      method: "GET",
      data: {

      }
    })
  }



  countAll() {
    return this.getData({
      url: '/countAll',
      method: "GET",
      data: {

      }
    })
  }

  maxPoint() {
    return this.getData({
      url: '/maxPoint',
      method: "GET",
      data: {

      }
    })
  }

  score() {
    return this.getData({
      url: '/score',
      method: "GET",
      data: {

      }
    })
  }

  dustbin(lng, lat, start, size) {
    return this.getData({
      url: '/dustbin',
      method: "GET",
      data: {
        lng: lng,
        lat: lat,
        start: start,
        size: size
      }
    })
  }

  addFeedback(content, title, communityId) {
    var data = {
      content: content,
      title: title,
      communityId: communityId
    }
    console.log("addFeedback post data:", data)
    return this.getData({
      url: '/addFeedback',
      method: "POST",
      data: data
    })
  }

  feedbackList(start, size) {
    return this.getData({
      url: '/feedbackList',
      method: "GET",
      data: {
        start: start,
        size: size
      }
    })
  }

  orderList(start, size,status) {
    return this.getData({
      url: '/orderList',
      method: "GET",
      data: {
        start: start,
        size: size,
        status: status
      }
    })
  }

  noticeList(start, size) {
    return this.getData({
      url: '/noticeList',
      method: "GET",
      data: {
        start: start,
        size: size
      }
    })
  }


  addOrder(communityId) {
    return this.getData({
      url: '/addOrder',
      method: "GET",
      data: {

      }
    })
  }

  addOrder(createBy) {
    return this.getData({
      url: '/addOrder',
      method: "GET",
      data: {
        createBy: createBy
      }
    })
  }

  dhList() {
    return this.getData({
      url: '/list',
      method: "POST",
      data: {
      }
    })
  }
  ljfl() {
    return this.getData({
      url: '/ljfl',
      method: "GET",
      data: {
      }
    })
  }

  communityList(keyword) {
    return this.getData({
      url: '/communityList',
      method: "GET",
      data: {
        keyword: keyword
      }
    })
  }

  scoreLogList(start, size) {
    return this.getData({
      url: '/scoreLogList',
      method: "GET",
      data: {
        start: start,
        size: size
      }
    })
  }

  garbageLog(start, size, garbageTypeId) {
    return this.getData({
      url: '/garbageLog',
      method: "GET",
      data: {
        start: start,
        size: size,
        garbageTypeId: garbageTypeId
      }
    })
  }

  uploadPic() {
    return this.getData({
      url: '/pic/upload',
      method: "POST",
      data: {

      }
    })
  }


  addPack(file) {
    return this.getData({
      url: '/addPack',
      method: "POST",
      data: {
        file: file
      }
    })
  }


  packList(start, size) {
    return this.getData({
      url: '/packList',
      method: "GET",
      data: {
        start: start,
        size: size
      }
    })
  }

  getDict() {
    return this.getDictData({
      method: "GET",
      data: {

      }
    })
  }
}

export {
  HttpApi
}